package com.example.design.practice.ratelimit.v1.rule;

import lombok.Getter;
import lombok.Setter;

/**
 * @Description TODO
 * @date 2022/11/16 15:33
 * @Author liuzhihui
 * @Version 1.0
 */
@Setter
@Getter
public class ApiLimit {
    // 1 second
    private static final int DEFAULT_TIME_UNIT = 1;
    private String api;
    private int limit;
    private int unit = DEFAULT_TIME_UNIT;

    public ApiLimit() {
    }

    public ApiLimit(String api, int limit) {
        this(api, limit, DEFAULT_TIME_UNIT);
    }

    public ApiLimit(String api, int limit, int unit) {
        this.api = api;
        this.limit = limit;
        this.unit = unit;
    }
}